<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>
<body>
    <div id='app'>
        {{msg}}


        <form action="">
            用户名:<input type="text" name="username" id="" v-model.lazy="username" @input="ipt" @change="change">
            密码：<input type="text" name="password" id="" v-model.lazy="password">
            <input type="submit" value="提交" name="" id="">
        </form>
    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue',
                username:"",
                password:""
            },
            methods:{
                ipt(){},
                change(){
                   if(this.username.length<6) return  alert("请输入长度为6的用户名")
                }
            }
        });
    </script>
</body>
</html>